# import asyncio, httpx
# from util.headers import get_headers_init_user_agent
#
#
# headers = get_headers_init_user_agent()
# urls = [f'https://webapi.sporttery.cn/gateway/lottery/getHistoryPageListV1.qry?gameNo=85&provinceId=0&pageSize=30&isVerify=1&pageNo={i}'for i in range(95)]
# async def fetch(session, url):
#     async with session.get(url, headers=headers) as response:
#         return await response.text()
#
# async def main():
#     async with httpx.AsyncClient() as session:
#         await asyncio.gather(*[fetch(session, url)for url in urls])
#
# r = asyncio.run(main())
# print(r)



import asyncio
import json

import aiohttp

headers = {'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36','referer':'https://static.sporttery.cn/'}
async def fetch(session,url):
    async with session.get(url,headers=headers) as response:
        response = await response.text()
        res_json = json.loads(response)
        # print(res_json)
        datas = res_json['value']['list']
        for data in datas:
            print(data['lotteryDrawResult'], data['lotteryDrawTime'])

async def main():
    async with aiohttp.ClientSession() as session:
        url_list = [f'https://webapi.sporttery.cn/gateway/lottery/getHistoryPageListV1.qry?gameNo=35&provinceId=0&pageSize=30&isVerify=1&pageNo={page}' for page in range(1,249)]
        tasks = [fetch(session,url) for url in url_list]
        await asyncio.gather(*tasks)
asyncio.run(main())